--[[ PLAYER]]

player = {
	x=160,
	y=192,
	direction_x = 0,
	direction_y = 0,
	is_moving = false,
	last_x=0,
	last_y=0,
	possibleDirection = {
		left = true,
		right = true,
		down = true,
		left = true,
	}
}

player.getMapX = function()
	return round(player.x/32)
end

player.getMapY = function()
	return round(player.y/32)
end

player.setPositionMap = function(x, y)
	player.x = (x*32)
	player.y = (y*32)
end

player.checkPossibleDirection = function()
	local map_player_pos_x = player.getMapX()
	local map_player_pos_y = player.getMapY()
	player.possibleDirection.right = map_player_pos_x+1 < map:getWidth()+1 and isWalkableTile(map.array[map_player_pos_y][map_player_pos_x+1])
	player.possibleDirection.left = map_player_pos_x-1 > 0 and isWalkableTile(map.array[map_player_pos_y][map_player_pos_x-1])
	player.possibleDirection.up = map_player_pos_y-1 > 0 and isWalkableTile(map.array[map_player_pos_y-1][map_player_pos_x])
	player.possibleDirection.down = map_player_pos_y+1 < map:getHeight()+1 and isWalkableTile(map.array[map_player_pos_y+1][map_player_pos_x])
end